/**
 * 功能描述
 */
define(function (require, exports, module) {
    //引入视图基类
    var ELView = require("elview");

    //assets
    var template = require("./assets/tpl/intentionregister_main.tpl");
    require("./assets/css/intentionregister_main.css");

    //business

    //component
    var intentionregisterSubnavComp = require("./component/intentionregisterSubnavComp");
    var intentionregisterGridComp = require("./component/intentionregisterGridComp");
    var tabComp = require("./component/tabComp");
    var questionnaireProfileComp = require("./component/questionnaireProfileComp");
    var visitFormComp = require("./component/visitFormComp");
    
    //constant
    
    //handler
    var IntentionRegisterSubnav_Events = require("./handler/IntentionRegisterSubnav_Events");
    var IntentionRegister_Events=require("./handler/IntentionRegister_Events")
    
    var visitway_main = ELView.extend({
        attrs: {
            template: template
        },
        events:{
			"change .J-form-visitRecord-select-product":function(e){
				IntentionRegister_Events.changeProduct(this,null);
			},
	        "change .J-form-visitRecord-date-personalInfo-birthday":function(e){
	        	IntentionRegister_Events.changeBirthday(this,this.get("form").getValue("personalInfo.birthday"));
			}
        },
        initComponent: function (params, widget) {
        	intentionregisterSubnavComp.initComponent(params, widget); 
        	intentionregisterGridComp.initComponent(params, widget); 
        	tabComp.initComponent(params, widget); 
        	questionnaireProfileComp.initComponent(params, widget); 
        	visitFormComp.initComponent(params, widget); 
        },
        afterInitComponent: function (params, widget) {
        	widget.get("subnav").load("product",{
                callback : function(data){
                	IntentionRegisterSubnav_Events.changeType(widget);
                }
            });
        }
    });

    module.exports = visitway_main;
});
